UPDATE `${updateTableName}` AS t
SET DATA_STATE_ID = (SELECT s.id FROM c1_dictionary s WHERE s.`TYPE_CODE` = 'DATA_STATE_TYPE' AND s.`CODE` = 'deleted')
WHERE NOT EXISTS(SELECT 1 FROM c1_dictionary e WHERE e.id = t.`DATA_STATE_ID` AND e.`TYPE_CODE` = 'DATA_STATE_TYPE' AND e.`CODE` = 'deleted')
AND NOW() > IFNULL(T.END_DATE, NOW())
